package cn.eleven.controller;

import cn.eleven.entity.ForumPost;
import cn.eleven.entity.User;
import cn.eleven.mapper.ForumPostMapper;
import cn.eleven.mapper.UserMapper;
import cn.eleven.mapper.UserMapperOne;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@CrossOrigin("*")
@RestController
@RequestMapping("/api")
public class SelectController {
    @Autowired
    UserMapper userMapper;
    @Autowired
    UserMapperOne userMapperOne;
    @Autowired
    ForumPostMapper areaMapper;

    @RequestMapping("/selectUser")
    public User test(){
        User user = userMapper.getUserById(1);
        return user;
    }

    @RequestMapping("/selectUserOne")
    public User testOne(){
        User user = userMapperOne.getUserById(1);
        return user;
    }

    @RequestMapping("/selectUserMany")
    public ForumPost testMany(){
        ForumPost forumPost = areaMapper.getForumPostById(1);
        return forumPost;
    }
}
